﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Role.aspx.cs" Inherits="SalesManagement.Modules.System.Role" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ Register Src="~/Controls/System/RoleForm.ascx" TagName="WindowEditor" TagPrefix="uc" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script language="javascript" type="text/javascript">
        function DocumentReady() {
            MethodNamespace.DocumentReady({
                success: function() {

                }
            });
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <ext:ResourceManager ID="ResourceManager" runat="server" DirectMethodNamespace="MethodNamespace">
        <Listeners>
            <DocumentReady Handler="DocumentReady();" Delay="10" />
        </Listeners>
    </ext:ResourceManager>
    <ext:Store ID="storeMain" runat="server">
        <Reader>
            <ext:JsonReader IDProperty="RoleId">
                <Fields>
                    <ext:RecordField Name="RoleId" />
                    <ext:RecordField Name="RoleName" />
                    <ext:RecordField Name="Description" />
                    <ext:RecordField Name="IsActive" />
                    <ext:RecordField Name="CreatedDate" />
                    <ext:RecordField Name="CreatedBy" />
                    <ext:RecordField Name="UpdatedDate" />
                    <ext:RecordField Name="UpdatedBy" />
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <ext:Viewport ID="Viewport1" runat="server" Layout="border">
        <Items>
            <ext:GridPanel ID="grdMain" runat="server" StripeRows="true" TrackMouseOver="true"
                AutoExpandColumn="RoleName" Border="false" Region="Center" StoreID="storeMain">
                <TopBar>
                    <ext:Toolbar ID="tbMain" runat="server">
                        <Items>
                            <ext:ToolbarSpacer />
                            <ext:Button ID="btnAdd" runat="server" Text="Tạo mới" Icon="TableAdd">
                                <DirectEvents>
                                    <Click OnEvent="btnAdd_Click" />
                                </DirectEvents>
                            </ext:Button>
                            <ext:ToolbarSpacer />
                            <ext:Button ID="btnPrint" runat="server" Text="In" Icon="Printer">
                                <DirectEvents>
                                    <Click OnEvent="btnPrint_Click" />
                                </DirectEvents>
                            </ext:Button>
                            <ext:ToolbarSpacer />
                            <ext:Button ID="btnImport" runat="server" Text="Nhập" Icon="TableRowInsert">
                                <DirectEvents>
                                    <Click OnEvent="btnImport_Click" />
                                </DirectEvents>
                            </ext:Button>
                            <ext:ToolbarSpacer />
                            <ext:Button ID="btnExport" runat="server" Text="Xuất" Icon="TableRowDelete">
                                <DirectEvents>
                                    <Click OnEvent="btnExport_Click" />
                                </DirectEvents>
                            </ext:Button>
                            <ext:ToolbarSpacer />
                            <ext:ToolbarFill />
                            <ext:TextField ID="txtKeyword" runat="server" EmptyText="Tìm kiếm" />
                            <ext:ToolbarSpacer />
                            <ext:Button ID="btnFind" runat="server" Text="Tìm kiếm" Icon="Find">
                                <DirectEvents>
                                    <Click OnEvent="btnFind_Click" />
                                </DirectEvents>
                            </ext:Button>
                        </Items>
                    </ext:Toolbar>
                </TopBar>
                <ColumnModel ID="ColumnModel1" runat="server">
                    <Columns>
                        <ext:RowNumbererColumn />
                        <ext:Column ColumnID="RoleName" DataIndex="RoleName" Header="Tên" />                        
                        <ext:Column ColumnID="Description" DataIndex="Description" Header="Ghi chú" />
                        <ext:CheckColumn Editable="false" ColumnID="IsActive" DataIndex="IsActive" Header="Kích hoạt"
                            Align="Center" Width="80" />
                        <ext:CommandColumn Width="80" ButtonAlign="Center">
                            <Commands>
                                <ext:GridCommand Icon="NoteEdit" CommandName="Edit" Text="Cập nhật">
                                </ext:GridCommand>
                            </Commands>
                        </ext:CommandColumn>
                        <ext:CommandColumn Width="80" ButtonAlign="Center">
                            <Commands>
                                <ext:GridCommand Icon="NoteDelete" CommandName="Delete" Text="Xóa">
                                </ext:GridCommand>
                            </Commands>
                        </ext:CommandColumn>
                    </Columns>
                </ColumnModel>
                <DirectEvents>
                    <Command OnEvent="grdMain_OnCommand">
                        <ExtraParams>
                            <ext:Parameter Name="command" Value="command" Mode="Raw" />
                            <ext:Parameter Name="id" Value="record.data.RoleId" Mode="Raw" />
                        </ExtraParams>
                        <Confirmation ConfirmRequest="true" Message="Bạn có thật sự muốn xóa dòng dữ liệu này không?"
                            Title="Thông báo" BeforeConfirm="if (command=='Edit') return false;" />
                    </Command>
                </DirectEvents>
                <SelectionModel>
                    <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true" />
                </SelectionModel>
                <BottomBar>
                    <ext:PagingToolbar ID="paddingBar" StoreID="storeMain" runat="server" PageSize="50"
                        DisplayInfo="true" DisplayMsg="Đang xem dòng {0} đến {1} của {2}" EmptyMsg="Không có dữ liệu">
                    </ext:PagingToolbar>
                </BottomBar>
            </ext:GridPanel>
        </Items>
    </ext:Viewport>
    <uc:WindowEditor ID="WindowEditor" runat="server" Flag="1" />
    </form>
</body>
</html>
